home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / DCLAP 4j / Drtf / DRichStyle.h < prev    next >
Encoding:
Text File  |  1995-12-17  |  4.3 KB  |  185 lines  |  [TEXT/R*ch]

  1. // DRichStyle.h
  2. // d.g.gilbert
  3.  
  4. #ifndef _DRICHSTYLE_
  5. #define _DRICHSTYLE_
  6.  
  7. #include "Dvibrant.h"
  8. #include "DObject.h"
  9.  
  10.  
  11.  
  12. struct PictLinkIndex {
  13.     short            fKind;
  14.   short            fLinkid;        // gopher/html link id 
  15.     Nlm_RecT    fLoc;
  16. };
  17.  
  18.  
  19. class DPictStyle : public DObject
  20. {
  21. public:
  22.     // this is a quick fix to having DPictStyle & others subclassing DRichStyle
  23.     // -- before the DRichStyle subclasses, must extensively revise DRS handling
  24.     // so that statically allocated (fixed size) DRS classes are gone & a DRS::Clone
  25.     // works  -- this is tied to problem of bad DObject::objSize for static alloc
  26.  
  27.     enum kinds {
  28.         kPictOther= 0,
  29.          kPictMac,
  30.          kPictWinMeta,
  31.          kPictPMMeta,
  32.          kPictDIBits,
  33.          kPictWinBits,
  34.          kPictGIF,
  35.          kPictNetPic,
  36.          kPictNetLink,
  37.          kPictMapLink
  38.         };
  39.  
  40.     short     fKind;
  41.     ulong        fSize;
  42.     char*        fData;
  43.     PictLinkIndex*    fLinks;
  44.     short        fNumLinks;
  45.  
  46.     DPictStyle();
  47.     DPictStyle( short kind, void* data, ulong dsize, Boolean owndata= false);
  48.     virtual    Boolean suicide(void);  // prefered to delete 
  49.     virtual    Boolean suicide(short ownercount);
  50.   virtual ~DPictStyle();
  51.     virtual void SetData( short kind, void* data, ulong dsize, Boolean owndata= false);
  52.     virtual void AddLink( short kind, short linkid, Nlm_RecT loc);
  53.     virtual short GetLink( Nlm_PoinT atp, short& kind);
  54.     virtual short GetLink( short index, short& kind, Nlm_RecT& loc);
  55.   virtual void Draw(Nlm_RecT area);
  56.     virtual Boolean HasNetPict();
  57.   virtual Boolean CanDraw();
  58.     virtual Boolean IsNotEqual( DPictStyle* other);
  59. };
  60.  
  61.  
  62.  
  63.  
  64. class DRichStyle : public DObject
  65. {
  66. public:
  67.     enum ulines {
  68.         kNoUnderline= 0,
  69.         kUnderline= 1,
  70.         kDotuline=2,
  71.         kDbluline=3,
  72.         kWorduline=4
  73.         };
  74.  
  75.     DPictStyle*    fPict;
  76.     short        nextofs;
  77.   short        pixheight, pixwidth, pixleft;        
  78.   short        linkid;        // gopher/html link id 
  79.  
  80.   Nlm_Uint4    color;
  81.     Nlm_FonT    font;                      // includes fnt,size,bld/ital/uline 
  82.     short             superSub;             //point offset +/-, +=superscript 
  83.   unsigned int  underline : 3; // 0,1=uline,2=dotuline,3=dbluline,4=worduline
  84.   unsigned int  bold        : 1;
  85.     unsigned int  italic    : 1;
  86.   unsigned int  outline        : 1;
  87.   unsigned int  shadow        : 1;
  88.   unsigned int  strikeout    : 1;
  89.   unsigned int  smallcaps    : 1;
  90.   unsigned int  allcaps        : 1;    
  91.   unsigned int  boxed            : 1;
  92.   unsigned int  hidden        : 1;
  93.   
  94.   unsigned int  ispict       : 1;
  95.   unsigned int  ownpict   : 1;
  96.   unsigned int  ismap       : 1;
  97.   unsigned int  last      : 1;
  98.  
  99.     DRichStyle();
  100.   virtual ~DRichStyle();
  101.     virtual    Boolean suicide(void);  // prefered to delete 
  102.     virtual    Boolean suicide(short ownercount);
  103.     virtual Boolean IsNotEqual(DRichStyle* other);
  104.     //virtual DObject* Clone();
  105.     //virtual DRichStyle&  operator=( DRichStyle& ast);
  106. };
  107.  
  108.  
  109. struct StyleIndex {
  110.     short    styleid;    
  111.     short    nextofs;
  112. };
  113.  
  114.  
  115. class DParagraph : public DObject
  116. {
  117. public:
  118.     enum borders {
  119.         kNoBorder = 0,
  120.         kBorderSingle = 1,
  121.         kBorderThick = 2,
  122.         kBorderShadow = 3,
  123.         kBorderDouble = 4,
  124.         kBorderDot = 5,
  125.         kBorderDash = 6,
  126.         kBorderHair = 7
  127.         };
  128.      
  129.     enum tabs {
  130.          kTabLeft = 0,
  131.          kTabCenter= 1,
  132.          kTabRight= 2,
  133.          kTabDecimal = 3,
  134.          kTabBar = 4
  135.         };
  136.  
  137.      char    just, tablead;                  
  138.   short        deftabstop, numstops;
  139.      short    * tabstops;
  140.      char    * tabkinds;
  141.   short   firstInset,leftInset,rightInset;
  142.     short        spaceBefore,spaceAfter, spaceBetween;
  143.   short     minLines, minHeight;
  144.   short     startsAt, numRows;     
  145.   short     lineHeight, leadHeight; 
  146.   
  147.   char    * fDataPtr;     
  148.   char    * fText;             
  149.     StyleIndex*    fStyleIndex;
  150.     short        fNumStyles;
  151.  
  152.   unsigned int    borderstyle        : 4;
  153.   unsigned int  bordertop        : 1;
  154.   unsigned int  borderbottom    : 1;
  155.   unsigned int  borderleft    : 1;
  156.   unsigned int  borderright      : 1;
  157.   unsigned int  borderbetween : 1;
  158.   unsigned int  borderbar       : 1;
  159.      unsigned int  borderbox        : 1;
  160.   unsigned int  openSpace    : 1;
  161.   unsigned int  keepWithNext : 1;
  162.   unsigned int  keepTogether : 1;
  163.   unsigned int  newPage      : 1;
  164.      unsigned int  wrap           : 1;    
  165.   unsigned int  fDocOwnsData : 1; 
  166.   unsigned int  fDocOwnsStyles : 1; 
  167.   unsigned int  notCached    : 1;  
  168.   unsigned int  neverCached  : 1; 
  169.     unsigned int    spaceMultiply: 1;
  170.  
  171.     DParagraph();
  172.     DParagraph( char* data, Boolean docOwnsData, short lines, DParagraph* parFmt, 
  173.                   StyleIndex* styles, short numstyle, Boolean docOwnsStyles = true); 
  174.     virtual ~DParagraph();
  175.     virtual    Boolean suicide(void);  // prefered to delete 
  176.     virtual    Boolean suicide(short ownercount);
  177.     void     Initialize();
  178.     void Copy(DParagraph* it);
  179.     //virtual DObject* Clone();
  180. };
  181.  
  182.  
  183. #endif
  184.  
  185.